//加载点聚、签章数据开始
function LoadSignDataH5(sign_arr) {
    try {
        for(var i=0;i<sign_arr.length;i++) {
            var str = $('input[name='+ sign_arr[i] +']').val();
            if(str != ""&&str.indexOf('DATA_HW:') > -1&&str.indexOf('DATA_SEAL:') > -1&&str.split('DATA_HW:')[1] != '') {
                var hw = str.split('DATA_HW:')[1].split('DATA_SEAL:')[0];
                var seal = str.split('DATA_HW:')[1].split('DATA_SEAL:')[1];

                if(hw != ''){
                    webSignDATABase(hw,sign_arr[i],'hw');
                }
                if(seal != ''){
                    webSignDATABase(seal,sign_arr[i],'seal');
                }
            }
        }

    }
    catch(e) {
        // alert("手写签章加载失败，请检查控件是否正确安装！");
    }
}

function webSignDATABase(string,id,type){
    $.ajax({
        type:'post',
        url:'/seal/parseAllSeal',
        data:{'sealData':string},
        dataType:'xml',
        success:function(obj){
            DjSign($(obj).find('seal_gif').html(),id,type,$(obj).find('user_id').html());
        }
    })
}
//加载点聚、签章数据结束
//移动端手写base64转为websign数据
var DATA_HW = '',DATA_SEAL = '';
function WebSign_Submit(id){
    var sign_val;
    if($('#'+id).parent().siblings('.divDJBox').find('.sealImg').length == 0&&$('#'+id).parent().siblings('.divDJBox').find('.hwImg').length == 0){
        return '';
    }else{
        var sealImgSrc = $('#'+id).parent().siblings('.divDJBox').find('.sealImg').attr('atturl');
        var hwImgSrc = $('#'+id).parent().siblings('.divDJBox').find('.hwImg').attr('atturl');
        if(hwImgSrc&&hwImgSrc != ''){
            parseAppSeal(hwImgSrc,id,'hw');
        }
        sign_val='DATA_HW:'+DATA_HW+'DATA_SEAL:'+sealImgSrc;
        DATA_HW = '';DATA_SEAL = '';
        return sign_val;
    }
}
function parseAppSeal(Src,id,type,special){
    if(type == 'hw'){
        var sealName = id+'_hw';
    }
    var sealPosition = 'SIGN_POS_'+id;

    $.ajax({
        type:'post',
        url:'/seal/parseAppSeal',
        data:{
            'sealData':Src,
            'sealW':0,'sealH':0,
            'sealX':'0','sealY':'0',
            'sealName':sealName,'sealPosition':sealPosition,
            'oriData':''
        },
        dataType:'text',
        async:false,
        success:function(obj){
            if(type == 'hw'){
                DATA_HW = obj;
            }
            if(special){
                return obj;
            }
        }
    });
}






















